Eclipse Platform
Pre-release 3.0

org.eclipse.ui.editors.text
Class TextEditor

java.lang.Object
  extended byorg.eclipse.ui.part.WorkbenchPart
      extended byorg.eclipse.ui.part.EditorPart
          extended byorg.eclipse.ui.texteditor.AbstractTextEditor
              extended byorg.eclipse.ui.texteditor.StatusTextEditor
                  extended byorg.eclipse.ui.texteditor.ExtendedTextEditor
                      extended byorg.eclipse.ui.editors.text.TextEditor
All Implemented Interfaces:
IAdaptable, IEditorPart, IExecutableExtension, INavigationLocationProvider, IReusableEditor, ISaveablePart, ITextEditor, ITextEditorExtension, ITextEditorExtension2, ITextEditorExtension3, IWorkbenchPart

public class TextEditor
extends ExtendedTextEditor

The standard text editor for file resources (IFile).

This editor has id "org.eclipse.ui.DefaultTextEditor". The editor's context menu has id #TextEditorContext. The editor's ruler context menu has id #TextRulerContext.

The workbench will automatically instantiate this class when the default editor is needed for a workbench window.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.ui.texteditor.AbstractTextEditor
AbstractTextEditor.LineStartAction
 
Nested classes inherited from class org.eclipse.ui.texteditor.ITextEditorExtension3
ITextEditorExtension3.InsertMode
 
Field Summary
protected  DefaultEncodingSupport fEncodingSupport
          The encoding support for the editor.
 
Fields inherited from class org.eclipse.ui.texteditor.ExtendedTextEditor
fAnnotationAccess, fLineNumberRulerColumn, fOverviewRuler, fSourceViewerDecorationSupport
 
Fields inherited from class org.eclipse.ui.texteditor.AbstractTextEditor
ACTION_MAP, DEFAULT_EDITOR_CONTEXT_MENU_ID, DEFAULT_RULER_CONTEXT_MENU_ID, fErrorLabel, PREFERENCE_COLOR_BACKGROUND, PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, PREFERENCE_COLOR_FIND_SCOPE, PREFERENCE_COLOR_FOREGROUND, PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, PREFERENCE_FONT, PREFERENCE_NAVIGATION_SMART_HOME_END, VERTICAL_RULER_WIDTH
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Fields inherited from interface org.eclipse.ui.texteditor.ITextEditorExtension3
INSERT, OVERWRITE, SMART_INSERT
 
Constructor Summary
TextEditor()
          Creates a new text editor.
 
Method Summary
protected  void createActions()
          Creates this editor's standard actions and connects them with the global workbench actions.
 void dispose()
          The AbstractTextEditor implementation of this IWorkbenchPart method may be extended by subclasses.
 void doSave(IProgressMonitor monitor)
          The AbstractTextEditor implementation of this IEditorPart method may be extended by subclasses.
 void doSaveAs()
          The AbstractTextEditor implementation of this IEditorPart method calls performSaveAs.
protected  void doSetInput(IEditorInput input)
          Internal setInput method.
 Object getAdapter(Class adapter)
          Returns an object which is an instance of the given class associated with this object.
protected  String getStatusBanner(IStatus status)
          Returns a banner for the given status.
protected  String getStatusHeader(IStatus status)
          Returns a header for the given status
protected  String getStatusMessage(IStatus status)
          Returns a message for the given status.
protected  void initializeEditor()
          Initializes this editor.
protected  void initializeKeyBindingScopes()
          Initializes the key binding scopes of this editor.
protected  void installEncodingSupport()
          Installs the encoding support on the given text editor.
 boolean isSaveAsAllowed()
          The AbstractTextEditor implementation of this IEditorPart method returns false.
protected  void performSaveAs(IProgressMonitor progressMonitor)
          The TextEditor implementation of this AbstractTextEditor method asks the user for the workspace path of a file resource and saves the document there.
protected  void updatePropertyDependentActions()
          Updates all property dependent actions.
 
Methods inherited from class org.eclipse.ui.texteditor.ExtendedTextEditor
configureSourceViewerDecorationSupport, createAnnotationAccess, createChangeHover, createChangeRulerColumn, createCompositeRuler, createLineNumberRulerColumn, createOverviewRuler, createPartControl, createSourceViewer, createVerticalRuler, disposeDocumentProvider, editorContextMenuAboutToShow, getAnnotationAccess, getAnnotationPreferenceLookup, getAnnotationPreferences, getDocumentProvider, getOverviewRuler, getSharedColors, getSourceViewerDecorationSupport, gotoMarker, handlePreferenceStoreChanged, hideOverviewRuler, initializeLineNumberRulerColumn, isChangeInformationShowing, isErrorStatus, isLineNumberRulerVisible, isOverviewRulerVisible, isPrefQuickDiffAlwaysOn, setDocumentProvider, showChangeInformation, showOverviewRuler
 
Methods inherited from class org.eclipse.ui.texteditor.StatusTextEditor
createStatusControl, doRevertToSaved, sanityCheckState, updatePartControl, updateStatusField
 
Methods inherited from class org.eclipse.ui.texteditor.AbstractTextEditor
addAction, addAction, addGroup, addRulerContextMenuListener, adjustHighlightRange, affectsTextPresentation, canHandleMove, close, configureInsertMode, createEmptyNavigationLocation, createNavigationActions, createNavigationLocation, doGetSelection, doSetSelection, editorSaved, enableSanityChecking, enableStateValidation, firePropertyChange, getAction, getContextMenuListener, getCoverage, getCursorListener, getCursorPosition, getEditorContextMenuId, getFontPropertyPreferenceKey, getHelpContextId, getHighlightRange, getInsertMode, getLegalInsertModes, getPreferenceStore, getProgressMonitor, getRangeIndicator, getRulerContextMenuId, getRulerMouseListener, getSelectionChangedListener, getSelectionProvider, getSourceViewer, getSourceViewerConfiguration, getStatusField, getVerticalRuler, handleCursorPositionChanged, handleEditorInputChanged, handleExceptionOnSave, handleInsertModeChanged, init, initializeViewerColors, internalInit, isDirty, isEditable, isEditorInputModifiable, isEditorInputReadOnly, isInInsertMode, isSaveOnCloseNeeded, isVisible, markAsContentDependentAction, markAsPropertyDependentAction, markAsSelectionDependentAction, markAsStateDependentAction, markInNavigationHistory, modelOffset2WidgetOffset, performRevert, performSave, rememberSelection, removeActionActivationCode, removeRulerContextMenuListener, resetHighlightRange, restoreSelection, rulerContextMenuAboutToShow, safelySanityCheckState, selectAndReveal, setAction, setActionActivationCode, setCompatibilityMode, setDocumentProvider, setEditorContextMenuId, setFocus, setHelpContextId, setHighlightRange, setInput, setInsertMode, setKeyBindingScopes, setPreferenceStore, setRangeIndicator, setRulerContextMenuId, setSourceViewerConfiguration, setStatusField, showHighlightRangeOnly, showsHighlightRangeOnly, updateContentDependentActions, updateSelectionDependentActions, updateState, updateStateDependentActions, updateStatusFields, validateEditorInputState, validateState, widgetOffset2ModelOffset
 
Methods inherited from class org.eclipse.ui.part.EditorPart
getEditorInput, getEditorSite, getTitleToolTip
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, getConfigurationElement, getDefaultImage, getJobChangeListener, getSite, getTitle, getTitleImage, removePropertyListener, setInitializationData, setSite, setTitle, setTitleImage, setTitleToolTip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IEditorPart
getEditorInput, getEditorSite
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 

Field Detail

fEncodingSupport

protected DefaultEncodingSupport fEncodingSupport
The encoding support for the editor.

Since:
2.0
Constructor Detail

TextEditor

public TextEditor()
Creates a new text editor.

Method Detail

initializeEditor

protected void initializeEditor()
Initializes this editor.

Overrides:
initializeEditor in class ExtendedTextEditor

initializeKeyBindingScopes

protected void initializeKeyBindingScopes()
Initializes the key binding scopes of this editor.

Overrides:
initializeKeyBindingScopes in class ExtendedTextEditor
Since:
2.1

dispose

public void dispose()
Description copied from class: AbstractTextEditor
The AbstractTextEditor implementation of this IWorkbenchPart method may be extended by subclasses. Subclasses must call super.dispose().

Specified by:
dispose in interface IWorkbenchPart
Overrides:
dispose in class ExtendedTextEditor

doSaveAs

public void doSaveAs()
Description copied from class: AbstractTextEditor
The AbstractTextEditor implementation of this IEditorPart method calls performSaveAs. Subclasses may reimplement.

Specified by:
doSaveAs in interface ISaveablePart
Overrides:
doSaveAs in class AbstractTextEditor

doSave

public void doSave(IProgressMonitor monitor)
Description copied from class: AbstractTextEditor
The AbstractTextEditor implementation of this IEditorPart method may be extended by subclasses.

Specified by:
doSave in interface ISaveablePart
Overrides:
doSave in class AbstractTextEditor
Parameters:
monitor - the progress monitor for communicating result state or null

installEncodingSupport

protected void installEncodingSupport()
Installs the encoding support on the given text editor.

Subclasses may override to install their own encoding support or to disable the default encoding support.

Since:
2.1

performSaveAs

protected void performSaveAs(IProgressMonitor progressMonitor)
The TextEditor implementation of this AbstractTextEditor method asks the user for the workspace path of a file resource and saves the document there.

Overrides:
performSaveAs in class AbstractTextEditor
Parameters:
progressMonitor - the progress monitor to be used

isSaveAsAllowed

public boolean isSaveAsAllowed()
Description copied from class: AbstractTextEditor
The AbstractTextEditor implementation of this IEditorPart method returns false. Subclasses may override.

Specified by:
isSaveAsAllowed in interface ISaveablePart
Overrides:
isSaveAsAllowed in class AbstractTextEditor

createActions

protected void createActions()
Description copied from class: AbstractTextEditor
Creates this editor's standard actions and connects them with the global workbench actions.

Subclasses may extend.

Overrides:
createActions in class ExtendedTextEditor

getStatusHeader

protected String getStatusHeader(IStatus status)
Description copied from class: StatusTextEditor
Returns a header for the given status

Overrides:
getStatusHeader in class StatusTextEditor
Parameters:
status - the status whose message is returned
Returns:
a header for the given status

getStatusBanner

protected String getStatusBanner(IStatus status)
Description copied from class: StatusTextEditor
Returns a banner for the given status.

Overrides:
getStatusBanner in class StatusTextEditor
Parameters:
status - the status whose message is returned
Returns:
a banner for the given status

getStatusMessage

protected String getStatusMessage(IStatus status)
Description copied from class: StatusTextEditor
Returns a message for the given status.

Overrides:
getStatusMessage in class StatusTextEditor
Parameters:
status - the status whose message is returned
Returns:
a message for the given status

doSetInput

protected void doSetInput(IEditorInput input)
                   throws CoreException
Description copied from class: AbstractTextEditor
Internal setInput method.

Overrides:
doSetInput in class StatusTextEditor
Throws:
CoreException

getAdapter

public Object getAdapter(Class adapter)
Description copied from interface: IAdaptable
Returns an object which is an instance of the given class associated with this object. Returns null if no such object can be found.

Specified by:
getAdapter in interface IAdaptable
Overrides:
getAdapter in class ExtendedTextEditor

updatePropertyDependentActions

protected void updatePropertyDependentActions()
Description copied from class: AbstractTextEditor
Updates all property dependent actions.

Overrides:
updatePropertyDependentActions in class AbstractTextEditor

Eclipse Platform
Pre-release 3.0

Copyright (c) IBM Corp. and others 2000, 2003. All Rights Reserved.